<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // Rest参数与spread扩展运算符在ES6中已经引入，不过ES6中只针对于数组，
    // 在ES9中为对象提供了像数组一样的rest参数和扩展运算符

    function connect({ host, port, ...user }) {
      console.log(host);
      console.log(port);
      console.log(user);
    }

    connect({
      host: 'localhost',
      port: 8080,
      username: 'why',
      password: '123456',
      type: 'master'
    });

    const skillOne = {
      q: '天音波'
    }

    const skillTwo = {
      q: '天音波',
      w: '金钟罩'
    }

    const mangseng = { ...skillOne, ...skillTwo }
    console.log(mangseng);    // {q: "天音波", w: "金钟罩"}


  </script>
</body>

</html>